import request from '@/utils/request'

// 查询课程信息列表
export function listRecords(query) {
  return request({
    url: '/course/records/list',
    method: 'get',
    params: query
  })
}

// 查询课程信息详细
export function getRecords(recordId) {
  return request({
    url: '/course/records/' + recordId,
    method: 'get'
  })
}

// 新增课程信息
export function addRecords(data) {
  return request({
    url: '/course/records',
    method: 'post',
    data: data
  })
}

// 修改课程信息
export function updateRecords(data) {
  return request({
    url: '/course/records',
    method: 'put',
    data: data
  })
}

// 删除课程信息
export function delRecords(recordId) {
  return request({
    url: '/course/records/' + recordId,
    method: 'delete'
  })
}

// 根据课程ID查询课程信息
export function getRecordsByCourseId(courseId) {
  return request({
    url: '/course/records/course/' + courseId,
    method: 'get'
  })
}
// 根据教师ID查询课程信息
export function getRecordsByTeacherId(teacherId) {
  return request({
    url: '/course/records/teacher/' + teacherId,
    method: 'get'
  })
}
export function searchCoursesByName(courseName) {
  return request({
    url: '/course/records/search',
    method: 'get',
    params: { courseName }
  })
}